 <html>
<head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
    <link rel="stylesheet" type="text/css" href="__CSS__/reset.css">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
    <link rel="stylesheet" type="text/css" href="__CSS__/wechat/wxpay.css">
    <script type="text/javascript" src="__JS__/jquery.js"></script>
    <title>支付详情</title>
</head>
<body>
    <div id="main">
    	<div class="user">
	    	<p class="list">
	    		<span class="name">支付人</span>
	    		<span class="text">{{:session('user.name')}}</span>
	    	</p>
	    	<p class="list">
	    		<span class="name">支付项目</span>
	    		<span class="text">资源人认证费</span>
	    	</p>
    		
    		<if condition="(isset($oinfo)) and ($oinfo['state'] eq 2)">
    			<p class="list">
		    		<span class="name">支付订单号</span>
		    		<span class="text">{{$oinfo['oid']}}</span>
		    	</p>
		    	<p class="list">
		    		<span class="name">支付金额</span>
		    		<span class="text">{{$oinfo['pmoney']/100}}</span>
		    	</p>
		    	<p class="list">
		    		<span class="name">支付时间</span>
		    		<span class="text">{{$oinfo['pt']|date="Y-m-d H:i:s",###}}</span>
		    	</p>
		    	<p class="list">
		    		<span class="name">支付方式</span>
		    		<span class="text">
		    			<switch name="$oinfo['pmode']">
		    				<case value='1'>微信支付</case>
		    			</switch>
		    		</span>
		    	</p>
    		</if>
    	</div>

    	<if condition="(!isset($oinfo)) OR ($oinfo['state'] eq 1)">
    		<div class="money">
	    		<div class="yuan">
	    			<div class="title">支付金额</div>
	    			<div class="num">10000.00</div>
	    			<div class="unit">元</div>
	    		</div>
	    	</div>
	    	<button class="btn" onclick="callpay()">微信支付</button>
    	</if>
    	
    </div>
    <div id="modal">
    	<span></span>
    </div>
	<script type="text/javascript">
		var disabled = true;
		function modalShow(msg){
			disabled = true;
			$("#modal").animate({
				bottom:"70px"
			},600,function(){
				setTimeout(function(){
					$(this).animate({
						bottom:"-100%"
					})
					
				}.bind(this),1500);
				
			}).find("span").html(msg);
		};
		//调用微信JS api 支付
		function jsApiCall()
		{
			WeixinJSBridge.invoke(
				'getBrandWCPayRequest',
				 {{$jsApiParameters}},
				function(res){
					WeixinJSBridge.log(res.err_msg);
					if(res.err_msg == "get_brand_wcpay_request:ok"){
						// modalShow("支付成功");
						window.location.href = "{{:url('wechat/Cons/infos')}}";
					}
				}
			);
		}

		function callpay()
		{	
			if(disabled){
				disabled = false;
				if (typeof WeixinJSBridge == "undefined"){
				    if( document.addEventListener ){
				        document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
				    }else if (document.attachEvent){
				        document.attachEvent('WeixinJSBridgeReady', jsApiCall); 
				        document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
				    }
				}else{
				    jsApiCall();
				}
			}
		}
		</script>
		<script type="text/javascript">
		//获取共享地址
		function editAddress()
		{
			WeixinJSBridge.invoke(
				'editAddress',
				{{$editAddress}},
				function(res){
					var value1 = res.proviceFirstStageName;
					var value2 = res.addressCitySecondStageName;
					var value3 = res.addressCountiesThirdStageName;
					var value4 = res.addressDetailInfo;
					var tel = res.telNumber;
					// alert(value1 + value2 + value3 + value4 + ":" + tel);
				}
			);
		}
		
		window.onload = function(){
			if (typeof WeixinJSBridge == "undefined"){
			    if( document.addEventListener ){
			        document.addEventListener('WeixinJSBridgeReady', editAddress, false);
			    }else if (document.attachEvent){
			        document.attachEvent('WeixinJSBridgeReady', editAddress); 
			        document.attachEvent('onWeixinJSBridgeReady', editAddress);
			    }
			}else{
				editAddress();
			}
		};
	</script>
</body>
</html>